Skip to main content

apache http server

Apache http server 使用教程

软件下载

下载地址

作为 windows 服务运行

完整教程地址

安装服务

httpd.exe -k install

卸载服务

httpd.exe -k uninstall

启动、暂停/关闭、重启服务

httpd.exe -k start / stop|shutdown / restart

命令都可以加 -n "MyServiceName" 指定服务名

httpd.exe -k install -n "MyServiceName"

配置文件路径

conf/httpd.conf

配置端口号

Listen 80

配置服务器根目录

DocumentRoot "D:/指定路径"
<Directory "D:/指定路径">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

关闭 error log

  1. Change "LogLevel warn" and "LogLevel info" entries to "LogLevel emerg".

    将日志等级改为 emerg

    LogLevel emerg
  2. Change "CustomLog logs/access.log common" and "CustomLog logs/access.log combined" entries to "#CustomLog logs/access.log combined".

    注释掉 CustomLog

     <IfModule log_config_module>
    #CustomLog "logs/access.log" common
    #CustomLog "logs/access.log" combined
    </IfModule>
  3. 删除 Apache2X\logs\error.log